#include "stdafx.h"
#include "WCELauncher.h"
#include "WceUiCommon.h"
#include "wceuirealwnd.h"
#include "./wceui/MainRealDlg.h"
ILauncher *CreateLauncher(Engine *pengine)
{
	return new CWCELauncher(pengine);
}

CWCELauncher::CWCELauncher(Engine *pengine):ILauncher(pengine)
{

}

CWCELauncher::~CWCELauncher()
{

}

bool CWCELauncher::Launch()
{
	bool ok=false;
#ifdef _WIN32_WCE
	WceUiInit(AfxGetInstanceHandle(), 
		L"exe_data\\main\\wnd", L"res2", L"exe_data\\main\\language\\en-us.ini", TRUE);
#else
	WceUiInit(AfxGetInstanceHandle(), 
		L"exe_data\\main\\wnd", L"res", L"exe_data\\main\\language\\en-us.ini", TRUE);
#endif

	CRealWnd wndParent;
	wndParent.Create(WS_POPUP, CRect(0, 0, 0, 0), NULL);

#ifdef _WIN32_WCE
	HWND hwndParent = wndParent.m_hWnd;
#else
	HWND hwndParent = NULL;
#endif


	CMainRealDlg dlg(this);
	int nScrWidth = WceUiGetScreenWidth();
	int nScrHeight = WceUiGetScreenHeight();
	dlg.DoModal(WS_VISIBLE|WS_POPUP, CRect(0, 0, nScrWidth, nScrHeight), hwndParent);

	wndParent.DestroyWindow();
	return ok;
}

LPCTSTR CWCELauncher::GetAppName()
{
	return L"CMainDlg";
}